
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@babel/plugin-proposal-function-bind
Advanced tools
@babel/plugin-proposal-function-bind is a Babel plugin that allows you to use the bind operator (::) in your JavaScript code. This operator is a syntactic sugar for function binding, making it easier to bind functions to a specific context.
Function Binding
This feature allows you to bind a function to a specific context using the bind operator (::). In this example, the greet function is bound to the obj context, so it correctly logs 'Hello, Alice!'.
const obj = {
name: 'Alice',
greet() {
console.log(`Hello, ${this.name}!`);
}
};
const greet = obj.greet::obj;
greet(); // Output: Hello, Alice!
Partial Application
This feature allows you to create partially applied functions using the bind operator (::). In this example, the add function is partially applied with the value 5, creating a new function add5 that adds 5 to its argument.
function add(a, b) {
return a + b;
}
const add5 = add.bind(null, 5);
console.log(add5(10)); // Output: 15
Lodash is a utility library that provides a wide range of functions for common programming tasks, including function binding. The _.bind method in Lodash can be used to bind functions to a specific context, similar to the bind operator in @babel/plugin-proposal-function-bind.
Ramda is a functional programming library for JavaScript that provides a variety of utility functions, including function binding. The R.bind method in Ramda can be used to bind functions to a specific context, offering similar functionality to the bind operator in @babel/plugin-proposal-function-bind.
Compile function bind operator to ES5
See our website @babel/plugin-proposal-function-bind for more information.
Using npm:
npm install --save-dev @babel/plugin-proposal-function-bind
or using yarn:
yarn add @babel/plugin-proposal-function-bind --dev
v7.25.9 (2024-10-22)
babel-parser
, babel-template
, babel-types
syntacticPlaceholders
mode (@liuxingbaoyu)babel-helper-compilation-targets
, babel-preset-env
ClassAccessorProperty
to prevent the no-undef
rule (@victorenator)babel-parser
, babel-types
VISITOR_KEYS
etc. faster to access (@liuxingbaoyu)FAQs
Compile function bind operator to ES5
We found that @babel/plugin-proposal-function-bind demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.